package com.thinkingstar.iads.cs.sys.controller;

import java.io.IOException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import com.thinkingstar.iads.common.utils.ImageUtil;
/**
 * 验证码相关
 * @author Administrator
 *
 */
@IocBean
@At("/verification")
public class ImageModule {
	
	private static final String CONTENT_TYPE = "image/jpeg;charset=GBK";
	
    /**
     * 更新验证码
     * @throws IOException 
     */
    @At("/getVerificationCode")
    public void getVerificationCode(HttpServletRequest request , HttpServletResponse response) throws IOException{
        response.setContentType(CONTENT_TYPE);
        ServletOutputStream out = response.getOutputStream();
        ImageUtil.getImage(out, request, response);
        out.close();
    }

}
